﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteUTF8.master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<web_uchet.Reports.ReportFilter>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Отчеты Вашей компании
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% string FormID="report-pars-form"; %>
<% using (Html.BeginForm("CompanyReport", "Report", new {id=ViewData["ReportID"].ToString() }, FormMethod.Post, new { id = FormID }))
   {%>

    <fieldset>
            <legend title="Здесь Вы 'фильтруете' отчет">Параметры отчета <% %></legend>
        <% foreach (var item in Model)
           { %>    
            <p>                
                <% switch (item.ControlType) { %>
                    <%case web_uchet.Reports.ReportFilterControlTypes.TextBox: %>
                        <%switch (item.DataType)
                          {%>
                            <%case web_uchet.Reports.ReportFilterDataTypes.String: %>
                                <label for="<%:item.DisplayName%>"><%:item.DisplayName%>:</label>
                                <%= Html.TextBox(item.Name, string.Empty, new { @class = "input-box", id = item.Name })%>

                            <%break; %>
                            <%case web_uchet.Reports.ReportFilterDataTypes.DateTime: %>

                                <% Html.RenderPartial("EditorTemplates/DateTimeTemplateViewData_Calend",
                                new web_uchet.Views.Shared.TemplateClasses.
                                DateTimeTemplateViewData(item.Name,item.Name, item.DisplayName,null)); %>

                            <%break; %>
                            <% case web_uchet.Reports.ReportFilterDataTypes.Numeric: %>

                                <% Html.RenderPartial("EditorTemplates/NumericTemplateViewData",
                                new web_uchet.Views.Shared.TemplateClasses.
                                NumericTemplateViewData(item.Name, item.Name, item.DisplayName, null, FormID)); %>

                            <%break; %>
                        <%} %>
                    <%break; %>
                    <%case web_uchet.Reports.ReportFilterControlTypes.SelectBox: %>
                        <label for="<%:item.DisplayName%>"><%:item.DisplayName%>:</label>
                        <%= Html.DropDownList(item.Name, item.SelectList.Select(e => new SelectListItem() {Text=e.Key,Value=e.Value })
                            , new { @class = "input-box", id = item.Name })%>
                    <%break; %>
                <%} %>

                <%= Html.ValidationMessage(item.Name, "*")%>
            </p>
        <% } %>
        <p>
            <input type="submit" value="Получить отчет" class="button" />
        </p>
    </fieldset>    
<%} %>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
<script src="/Scripts/jquery.maskedinput-1.2.2.min.js" type="text/javascript"></script>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="HintListPlaceHolder" runat="server">
</asp:Content>

